/**
 * Created by fangshufeng on 2017/7/13.
 */


import React, {Component,PropTypes} from 'react';
import {
    View,
    Text,
    StyleSheet,
    TouchableOpacity,
    Image,
} from 'react-native';

// let  icon =  require('./mzFB_msg_user@2x.png');

class TestDemo3 extends  Component {

    constructor(props){
        super(props);
        this.state={
            name:'fangshufeng',
            title:'hahaha',
            defaultIcon:require('./mzFB_msg_user@2x.png'),
        }

        // this.icon = require('./mzFB_msg_user@2x.png');
    }

    render(){
        return (
            <View style={styles.mainStyle} >

                <TouchableOpacity activeOpacity={0.9}
                                  onPress={this.changText}
                >

                    <Text>{this.state.name}</Text>
                </TouchableOpacity>
                <Image source={this.state.defaultIcon} style={{width:100,height:100,justifyContent:'center',alignItems:'center'}}>
                    <Text style={{backgroundColor:'rgba(0,0,0,0.5)'}}>daksdhkaj</Text>
                </Image>
            </View>


        );
    }

    changText = () =>  {
        console.log(this);
        this.setState({
                defaultIcon:{uri:'https://facebook.github.io/react/img/logo_og.png'},
            },
        );
    }
}

const  styles = StyleSheet.create({
        mainStyle:{
            flex:1,
            justifyContent:'center',
            alignItems:'center',
        },
    }
);

export  default  TestDemo3;